#pragma once
#ifndef _WhSocket_
#define _WhSocket_

#define bufSize 65535

typedef struct{
	char ip[255];
	char mask[255];
	char lowIp[255];
	char highIp[255];
}NetWorkInfo;

typedef unsigned char uchar, u_char, UINT8;
typedef unsigned short ushort, u_short, UINT16;
typedef unsigned int uint, u_int, UINT32;

void whSocketBind(int port, HANDLE callback);

SOCKET* whSocketConnect(const char* ip, int port);

SOCKET* whSocketConnect(const char* ip, int port, int timeout);

SOCKET* whSocketConnectNonBlock(const char* ip, int port, int timeout);

int testConnect(const char* ip, int port, int timeout);

void whSocketClose(SOCKET* s);

void whSocketCloseNonBlock(SOCKET* s);

void setTimeout(SOCKET* s, int timeout);

//send string read string
int sendStr(const char* ip, int port, char* send, char* read, int len);

int sendStr(const char* ip, int port, char* send, int timeout);

//send string no read
int sendStr(SOCKET* s, char* str);

int send_new_size(int width, int height);

#endif